<?php

if(!isset($_SESSION['username'])){
		echo "<script>alert('请登录！');window.location.href='index.php?m=admin&c=manage'</script>";die;
	}


	//权限管理
	authonity($con);

	$id = $_GET['id'];

	$aid = $_GET['aid'];

	$mid = $_GET['mid'];

	$data = dbselOne($con,'about_us','*',$id);

	assign('data',$data);

	if($_POST){
		$content =rtrim($_POST['content'],'</p>');

		$cont =ltrim($content,'<p>');

		$data['content'] = htmlspecialchars(trim($cont,''));


		if(!empty($_FILES['image'])){
				$imgsrc = $_FILES['image'];
				if($imgsrc['size'] != 0){
					$path = uploadsIMG($imgsrc);
					$img = overSize_thumb($path);
					$data['img_path'] = json_encode($img);
				}
			}




		$data['tumover_time'] = time();

		$query = dbupdate($con,'about_us',$data,"id=$id");

		if($query){
			echo "<script>alert('修改成功');location.href='index.php?m=admin&c=about_us&mid=$mid&aid=$aid'</script>";
		}else{
			echo "<script>alert('修改失败');location.href='index.php?id={$id}&m=admin&c=about_us&v=abt_upd&mid=$mid&aid=$aid'</script>";
		}




	}
	






?>